package a.f.h.e;

import a.c.e;
import a.c.*;
import a.f.h.b.f;
import a.f.h.b.h;
import a.f.j.ab;
import a.f.j.o;
import a.i.mb;

public class d
  implements a.f.h.b.b
{
  protected q a;
  protected f b;
  private a.c.n c;
  private a.c.n d;
  private static double e = 0.001D;
  private int f = 0;
  private static final Integer g = new Integer(0);
  private static final Integer h = new Integer(1);
  private static final Integer i = new Integer(3);
  private boolean j = false;
  public static boolean k;
  
  public int b()
  {
    return this.f;
  }
  
  public void a(f paramf)
  {
    this.b = paramf;
    this.a = this.b.a();
  }
  
  public void a()
  {
    a.i.n.a(this, 1, "------->>> Entering Layout Phase");
    mb localmb1 = new mb();
    mb localmb2 = new mb();
    q localq = new q();
    x localx = localq.B();
    a.c.n localn1 = localq.C();
    a.c.n localn2 = localq.C();
    a(localq, localx, localn1, localn2);
    a.i.n.a(this, 3, "Prof: ---> Constructing network took " + localmb2);
    a.c.n localn3 = this.a.C();
    a(localq, localx, localn1, localn2, localn3);
    if (!a.v)
    {
      if (this.j)
      {
        h localh = new h();
        a.c.k localk = this.a.c("y.layout.orthogonal.general.NodeSplitter.NODE_FACES");
        ab localab = this.b.b();
        localh.a(this.b, new a.i.p()
        {
          private final a.c.n val$bends;
          private final a.c.k val$nf;
          private final ab val$pi;
          
          public boolean getBool(Object paramAnonymousObject)
          {
            boolean bool = a.v;
            a.c.d locald = (a.c.d)paramAnonymousObject;
            if (!bool) {
              if (((String)this.val$bends.get(locald)).length() <= 0)
              {
                if (bool) {
                  break label88;
                }
                if (!this.val$nf.getBool(this.val$pi.c(locald))) {
                  if (bool) {
                    break label88;
                  }
                }
              }
            }
            label88:
            return this.val$nf.getBool(this.val$pi.c(this.val$pi.b(locald)));
          }
        });
      }
      this.b.a(localn3, this.a.w().a(), a.f.h.b.k.a);
      this.a.a(localn3);
      localq.a(localx);
      localq.a(localn1);
      localq.a(localn2);
      a.i.n.a(this, 1, "Prof: -> Total running time of layout Phase: " + localmb1);
    }
    a.i.n.a(this, 1, "<<<------- Leaving Layout Phase");
  }
  
  private void a(q paramq, x paramx, a.c.n paramn1, a.c.n paramn2)
  {
    boolean bool = a.v;
    int n = a.u;
    Integer localInteger = new Integer(4 * this.a.m());
    e locale1 = paramq.i();
    e locale2 = paramq.i();
    this.d = this.a.C();
    this.c = this.a.C();
    x localx = paramq.B();
    a.f.j.p localp = this.b.h();
    a.c.k localk = this.a.c("y.layout.orthogonal.general.NodeSplitter.NODE_FACES");
    Object localObject1 = this.a.v();
    e locale3;
    Object localObject3;
    do
    {
      if (!((w)localObject1).e()) {
        break;
      }
      localObject2 = ((w)localObject1).d();
      if (!bool)
      {
        if (((e)localObject2).d() < 4)
        {
          locale3 = paramq.i();
          paramx.a(locale3, g);
          localObject3 = paramq.a(locale1, locale3);
          paramn1.a(localObject3, g);
          paramn2.a(localObject3, 4 - ((e)localObject2).d());
          localx.a(localObject2, locale3);
        }
        ((w)localObject1).f();
      }
    } while (n == 0);
    localObject1 = this.b.c();
    label342:
    do
    {
      do
      {
        if (!((o)localObject1).e()) {
          break;
        }
        localObject2 = ((o)localObject1).a();
        locale3 = paramq.i();
        paramx.a(locale3, g);
        if ((!bool) && (n != 0)) {
          break label516;
        }
        if (!bool)
        {
          if (((a.f.j.n)localObject2).a().k() < 4)
          {
            if (bool) {
              break label342;
            }
            if (this.b.d() != localObject2)
            {
              localObject3 = paramq.a(locale1, locale3);
              paramn1.a(localObject3, g);
              paramn2.a(localObject3, 4 - ((a.f.j.n)localObject2).a().k());
            }
          }
          if (bool) {}
        }
        else if (((a.f.j.n)localObject2).a().k() > 4)
        {
          if (bool) {
            break label427;
          }
          if (this.b.d() != localObject2)
          {
            localObject3 = paramq.a(locale3, locale2);
            paramn1.a(localObject3, g);
            paramn2.a(localObject3, ((a.f.j.n)localObject2).a().k() - 4);
          }
        }
        if (this.b.d() == localObject2)
        {
          localObject3 = paramq.a(locale3, locale2);
          paramn1.a(localObject3, g);
          paramn2.a(localObject3, ((a.f.j.n)localObject2).a().k() + 4);
        }
        localp.a((a.f.j.n)localObject2, locale3);
        ((o)localObject1).f();
      } while (n == 0);
    } while (bool);
    label427:
    localObject1 = this.b.c();
    label516:
    label696:
    do
    {
      if (!((o)localObject1).e()) {
        break;
      }
      localObject2 = ((o)localObject1).a();
      locale3 = (e)localp.get(localObject2);
      localObject3 = ((a.f.j.n)localObject2).a();
      do
      {
        do
        {
          if (!((m)localObject3).e()) {
            break label769;
          }
          a.c.d locald1 = ((m)localObject3).a();
          a.f.j.n localn = this.b.b(this.b.a(locald1));
          e locale4 = (e)localp.get(localn);
          a.c.d locald2 = paramq.a(locale3, locale4);
          paramn1.a(locald2, h);
          this.c.a(locald1, locald2);
          if (n != 0) {
            break;
          }
          if (localk.getBool(localn))
          {
            if (bool) {
              break label696;
            }
            paramn2.a(locald2, g);
            if (n == 0) {}
          }
          else
          {
            paramn2.a(locald2, localInteger);
          }
          e locale5 = (e)localx.get(locald1.e());
          if (!bool)
          {
            if (locale5 != null)
            {
              a.c.d locald3 = paramq.a(locale5, locale3);
              paramn1.a(locald3, g);
              paramn2.a(locald3, i);
              this.d.a(locald1, locald3);
            }
            ((m)localObject3).f();
          }
        } while (n == 0);
        ((o)localObject1).f();
      } while (bool);
    } while (n == 0);
    label769:
    int m = 0;
    Object localObject2 = locale1.n();
    if (((m)localObject2).e())
    {
      m += paramn2.getInt(((m)localObject2).a());
      ((m)localObject2).f();
    }
    for (;;)
    {
      if ((bool) || (n == 0))
      {
        if (n == 0) {
          break;
        }
        paramx.a(locale1, m);
        if (!bool) {
          paramx.a(locale2, -m);
        }
      }
    }
  }
  
  protected void a(q paramq, x paramx, a.c.n paramn1, a.c.n paramn2, a.c.n paramn3)
  {
    boolean bool = a.v;
    int i2 = a.u;
    mb localmb = new mb();
    this.f = 0;
    a.c.n localn = paramq.C();
    b localb = new b();
    localb.a(paramq, null, paramn2, paramn1, paramx, localn, null);
    a.i.n.a(this, 3, "Prof: ---> Solving Network took " + localmb);
    localmb.g();
    a.i.n.a(this, 5, "Bends of edges: ");
    m localm = this.a.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      a.c.d locald = localm.a();
      StringBuffer localStringBuffer = new StringBuffer();
      int m = localn.getInt(this.c.get(locald));
      int n = localn.getInt(this.c.get(this.b.a(locald)));
      a(localStringBuffer, n, '>');
      a(localStringBuffer, m, '<');
      this.f += localStringBuffer.length();
      paramn3.a(locald, localStringBuffer.toString());
      if ((!bool) && (i2 != 0)) {
        return;
      }
      if ((bool) || (locald.e().d() < 4))
      {
        int i1 = localn.getInt(this.d.get(locald));
        this.b.a(locald, i1 + 1);
        if (bool) {
          continue;
        }
        if (i2 == 0) {}
      }
      else
      {
        this.b.a(locald, 1);
      }
      localm.f();
    } while (i2 == 0);
    this.f /= 2;
    a.i.n.a(this, 1, "Stat: Number of bends: " + this.f);
    if (!bool) {
      a.i.n.a(this, 3, "Prof: ---> Parsing ILP solution took " + localmb);
    }
  }
  
  private static void a(StringBuffer paramStringBuffer, double paramDouble, char paramChar)
  {
    boolean bool = a.v;
    int i1 = a.u;
    int m = (int)Math.floor(paramDouble + e);
    int n = 0;
    do
    {
      while (i1 == 0)
      {
        if (n >= m) {
          break;
        }
        paramStringBuffer.append(paramChar);
        n++;
      }
    } while (bool);
  }
  
  public boolean c()
  {
    return this.j;
  }
  
  public void a(boolean paramBoolean)
  {
    this.j = paramBoolean;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.e.d

 * JD-Core Version:    0.7.0.1

 */